^ What's the point?
^ Audio Bezier Curves Library in shareware and commercial software?
^ Installation
^ Values
^ Start, End and Base values
^ Increasing the quality of the display even more
^ Interactive mode control points
^ Interactive Delphi class
^ Interactive mode with the DLL version
^ Using custom curves with the DLL version

Download :: Top
Audio Bezier Curves Library Component

Audio Bezier Curves Library is a component for Delphi (Win32, Win64) and a standalone DLL, based on Graphics32 for displaying of curves related to audio, like filters, effects and envelopes.

Features:
  • Very high quality antialiased rendering with transparency
  • Plus-minus, plus, low-pass and high-pass curve types
  • Interactive mode: drag control points with mouse
  • Option to easily draw custom curves
  • Multiple curves on a single display are supported
  • Linear and logarithmic grid option
  • Customizable colors and graphics




Audio Bezier Curves Library in shareware and commercial software?

The component comes with full source code and can be evaluated freely. If you like it and decide to use it in a freeware, shareware or commercial (or any other money making - advertising, in app. selling, etc.) product one of the licenses is needed.


Installation

If Graphics32 is not already installed, it's recommended to install it - although it's not needed to install it for Audio Bezier Curves Library to compile, it's enough to have the Graphics32 units on the search path. But Graphics32 is a great component you might want to decide to use it. Latest version of Graphics32 can be downloaded from: When installing Graphics32 into Delphi, first install the 'GR32_R' then the 'GR32_D', if you get a not supported error, define "VER_LATEST" in the Project/Options->Delphi compiler/Conditional defines. You may also need to add to the search path the GR32 'Source' folder.

To install the interactive component, it is needed to install Graphics32 first, then 'AudioBezierCurves.pas'.

Install a desired package from the 'Packages' folder.

Or to create a new package from scratch:
  • Create a new package, menu: File/New/Package - Delphi, save it with a new name, menu: File/Save Project As.... for example 'PackageAudioBezierCurves_Sydney.bpl' - always use a unique package name for different Delphi versions.
  • In project manager (in the upper-right corner by default), right-click on "PackageAudioBezierCurves_Sydney.dproj" and select "Add...".
  • Unit file name: click "Browse" and select "AudioBezierCurves.pas" and click "OK".
  • In project manager (in the upper-right corner by default), right-click on "PackageAudioBezierCurves_Sydney.dproj" and select "Build" then "Install...".
  • Save the package again.

Note: it is needed for the (eg. named) "PackageAudioBezierCurves_Sydney" package's "requires" list to have the Graphics32 package name eg. "GR32_R" (or the name used to install the Graphics32 package).

If everything went smooth, you can access the 'TAudioBezierCurvesInteractive' component on 3delite's tab.


Values

All parameter values used by the component are in the range 0 to + 1.0 or - 1.0 to + 1.0. Using values outside these ranges result an undefined behavior.
Color values are in 32 bit ARGB format.


Start, End and Base values

'ValueStart' and 'ValueEnd' values are absolute values. To move the whole curve up or down use the 'BaseValue' parameter.


Increasing the quality of the display even more

The curves are drawn with antialiasing, although not in 100% perfect quality.
To increase the quality of the display even more set the bitmap size to a larger value than the final size, eg. using '* 2' results a 2x antialiased final image if the bitmap has a high quality resampler set, and 'ScaleMode' is set to 'smResize'.
It's quite slow, though usable with a small display (it looks much better).
Note that the 'LineThickness' value is scaled in this process so set it to eg. '* 2' to have the same final thickness of the curve in the final image.
Please see the 'Tutorial Audio Bezier Curves Delphi LowPass HighPass' source code for an example.

For the DLL version there is a parameter 'TAudioBezierCurvesParameters.AntialiasingLevel' to achieve the same antialiasing effect.


Interactive mode control points

With the Delphi component there is a 'OnCustomDrawControlPoint' event, that can be used to draw a custom graphics for the control points.
The event can be used also to simply load (or just call Assign() for an already loaded bitmap) a transparent picture file - one for the normal, one for the 'hot' bitmap. There are some useful functions in 'GR32_TBitmap.pas' for TBitmap-TBitmap32 conversion.
For the DLL version the callback 'CustomControlDrawCallback' needs to be specified that expects a returned HBitmap. The 'BitmapHandle' needs to be a 32 bit transparent image.


Interactive Delphi class

The Delphi interactive class is based on the Graphics32 TImage class, so it's possible to add custom layers to the display.
Please see the 'TAudioBezierCurvesInteractive.DisplayControlPoint()' and 'TAudioBezierCurvesInteractive.DisplayControlPointText()' functions on how to add a layer to the display and 'TAudioBezierCurvesInteractive.RepositionControlPoints()' on how to position them.


Interactive mode with the DLL version

To create an interactive instance specify the destination control (eg. a panel) with the 'ParentHandle' parameter. If 'ParentHandle' is '0' a non-visual instance is created.
Use the 'AudioBezierCurves_ReAlign()' function to resize the instance on size change when needed.
To display texts beside the control points set the 'GetControlPointTextCallback' function when creating the instance. The callback function's 'Text' buffer pointer supports setting max. 255 unicode characters and multi-line text, separated with a #13#10 character pair.
To display the texts set also 'ControlPointTextShow' to either 'ABC_CP_TEXT_SHOW' or 'ABC_CP_TEXT_SHOW_ON_HOVER'. To set the font used, set simply 'ControlPointTextFontName' and/or 'ControlPointTextFontSize', for full control use the 'ControlPointTextFontHandle' parameter that expects a 'HFONT' that has priority over the font name and size parameter.


Using custom curves with the DLL version

Define the curve type 'CurveType' as 'ABC_CURVE_TYPE_CUSTOM' and implement the 'CustomCurveCallback' function.
The 'CustomCurve' parameter supports up to 1000 values. The first value is the starting point where only the 'P' value is used. Consecutive values are relative to the previous 'P' position. If 'C2IsRelativeToP' is 'True', 'C2.X' and 'C2.Y' positions are treated as values relative to the 'P.X' and 'P.Y' parameters. I suggest using the 'C2IsRelativeToP' mode as it simplifies the code.
Set 'CurveCount' to the actual array length used.
Set 'GradientType' to a value needed for the type of the gradient to apply. If 'ABC_GRADIENT_TYPE_PLUS' is specified the gradient starts from absolute top, down to absolute bottom. Note that the gradient is applied as the values create a polygon. So define the curve points in a way so they define a polygon (eg. starting and ending points are connected and they define a polygon, together with all the values that is used for the gradient).
To define a straight line, use '0' values for both control points' 'X' and 'Y'.


[Top]